package com.tom.service.impl;

import com.tom.mapper.AccountMapper;
import com.tom.model.Account;
import com.tom.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Integer updateAccount(Account account) {
        accountMapper.addMoney(1,(Double) 10.0);
//        int a = 1/0;
        accountMapper.subMoney(2,(Double) 10.0);

        return 1;
//        return accountMapper.updateAccount(account);
    }
}
